<template>
  <div style="min-height: 300px">
    <a-form :model="entity" :rules="rules" label-width="120px">
      <a-form-item label="贸易单号" field="hth">
        <a-input v-model="entity.hth"  />
      </a-form-item>
      <a-form-item label="销售订单号" field="xxdd">
        <a-input v-model="entity.xxdd" disabled  />
      </a-form-item>
      <a-form-item label="来料方式" field="xxdd">
        <a-select placeholder="Please select ..." default-value="1" allow-clear>
          <a-option value="1">来料</a-option>
          <a-option value="2">自购原料</a-option>
        </a-select>
      </a-form-item>
      <a-form-item label="产品类型" field="xxdd">
        <a-select placeholder="Please select ..." default-value="1" allow-clear>
          <a-option value="1">棒材</a-option>
          <a-option value="2">齿轮箱锻件</a-option>
        </a-select>
      </a-form-item>
    </a-form>

    <a-table :bordered="{cell:true}" :pagination="false" stripe :data="entity.orderList">
      <template #columns>
        <a-table-column title="行号" data-index="lineno" width="70"></a-table-column>
        <a-table-column title="钢种" data-index="pinming" width="80"></a-table-column>
        <a-table-column title="订单数量(T)" data-index="count" width="120"></a-table-column>
        <a-table-column>
          <template #title>产品标识号<br/><span style="color: #f60000">代替钢种、炉号等现场标识管理方式</span></template>
          <template #cell="{ record }"><a-input v-model="record.cpm"  /></template>
        </a-table-column>
        <a-table-column title="来料规格(T)">
          <template #cell="{ record }"><a-input /></template>
        </a-table-column>
        <a-table-column title="锻造规格">
          <template #cell="{ record }"><a-input /></template>
        </a-table-column>
        <a-table-column title="生产支数">
          <template #cell="{ record }"><a-input /></template>
        </a-table-column>
        <a-table-column title="生产重量(T)">
          <template #cell="{ record }"><a-input /></template>
        </a-table-column>
        <a-table-column title="生产管理模式" width="180">
          <template #cell="{ record }">
            <a-select placeholder="Please select ..." default-value="1" allow-clear>
              <a-option value="1">批次管理</a-option>
              <a-option value="2">单件管理</a-option>
            </a-select>
          </template>
        </a-table-column>
        <a-table-column title="炉号">
          <template #cell="{ record }"><a-input   /></template>
        </a-table-column>
      </template>
    </a-table>

    <br />
    <a-form :model="entity" :rules="rules" label-width="120px">
      <a-form-item label="备注" field="remark">
        <a-textarea v-model="entity.remark" auto-size ></a-textarea>
      </a-form-item>
    </a-form>
  </div>
</template>

<script lang="ts" setup>
import {reactive, ref, onMounted, defineProps, defineEmits, nextTick} from "vue";

const emit = defineEmits(['update:modelValue'])
let props = defineProps({
  modelValue : {type : Boolean, default: true},
  entityId : {type : Number, default: 0}
})

let entity = reactive({
  id : props.entityId,
  hth: '',
  xxdd: 'S2025010010',
  remark: '技术要求：' +
    '1:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' +
    '\r\n2:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' +
    'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',

  orderList : [
    {lineno:10, hth:'2022-2L-29',pinming:'H13',guige:'@220(0,+3)', count:'27.45T', cpm:'H13-A1'},
    {lineno:20, hth:'2022-2L-29',pinming:'H13',guige:'@250(0,+3)', count:'15.45T', cpm:'H13-A1'},
    {lineno:30, hth:'2022-2L-29',pinming:'H15',guige:'@320(0,+5)', count:'27.45T', cpm:'H15-A1'}
  ]
})

const rules = reactive({
  hth: [
    { required: true, message: '请输入工序编码', trigger: 'blur' },
  ],
  xxdd: [
    { required: true, message: '请输入工序名称', trigger: 'blur' },
  ],
})

onMounted(()=>{
  nextTick(()=>{
  })
})
</script>

<style scoped>

</style>
